define rtl_path
	build/Catapult_$(1)/$(1).v1/concat_rtl.v
endef

define run_script
	catapult -shell -file ./scripts/$(1).tcl
endef

rtl: $(call rtl_path,AcceleratorTop)

$(call rtl_path,AcceleratorTop): $(call rtl_path,TensorCore)
	$(call run_script,AcceleratorTop)

$(call rtl_path,TensorCore): $(call rtl_path,InputController) $(call rtl_path,WeightController) $(call rtl_path,MatrixProcessor) $(call rtl_path,VectorUnit)
	$(call run_script,TensorCore)

$(call rtl_path,InputController): 
	$(call run_script,InputController)

$(call rtl_path,WeightController): 
	$(call run_script,WeightController)

$(call rtl_path,MatrixProcessor): 
	$(call run_script,MatrixProcessor)

$(call rtl_path,VectorUnit): $(call rtl_path,ScaleUnit) $(call rtl_path,FetchUnit) $(call rtl_path,OutputAddressGenerator) $(call rtl_path,SoftmaxUnit) $(call rtl_path,LayerNormUnit) 
	$(call run_script,VectorUnit)

$(call rtl_path,ScaleUnit): 
	$(call run_script,ScaleUnit)

$(call rtl_path,FetchUnit): 
	$(call run_script,FetchUnit)

$(call rtl_path,OutputAddressGenerator): 
	$(call run_script,OutputAddressGenerator)

$(call rtl_path,SoftmaxUnit): 
	$(call run_script,SoftmaxUnit)

$(call rtl_path,LayerNormUnit): 
	$(call run_script,LayerNormUnit)
